package com.lds.config.center.remote.client.server.impl;


import com.lds.config.center.common.model.item.request.ItemBaseListRequest;
import com.lds.config.center.common.model.item.response.ItemBaseListResponse;
import com.lds.config.center.remote.client.properties.ConfigCenterRemoteClientProperties;
import com.lds.config.center.remote.client.server.ItemRemoteClient;
import com.lds.management.center.common.model.dto.ResultDTO;
import com.lds.management.center.common.util.RestUtil;
import org.springframework.core.ParameterizedTypeReference;

public class ItemRemoteClientImpl implements ItemRemoteClient {
    private final ConfigCenterRemoteClientProperties properties;
    
    public ItemRemoteClientImpl(ConfigCenterRemoteClientProperties properties) {
        this.properties = properties;
    }
    
    
    @Override
    public ResultDTO<ItemBaseListResponse> listItem(ItemBaseListRequest request) {
        String url = properties.getAddress() + "/api/common/item/list";
        return RestUtil.post(url, request, new ParameterizedTypeReference<ResultDTO<ItemBaseListResponse>>() {});
    }
}
